package com.yonyou.pmclouds.projectlog.mapper;

import com.yonyou.pmclouds.basecom.dao.BaseMapper;
import com.yonyou.pmclouds.projectlog.entity.ProjectLogDetailVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author xiejianyu
 * 2019-09-19
 */
@Mapper
public interface ProjectLogDetailMapper extends BaseMapper<ProjectLogDetailVo> {

    List<ProjectLogDetailVo> queryProjectLogDetails(@Param("pkProjectLog") String pkProjectLog);

    ProjectLogDetailVo queryProjectLogDetailByTypeAndContentSource(@Param("pkProjectLog") String pkProjectLog, @Param("detailType") int detailType, @Param("pkContentSource") String pkContentSource);

    /**
     * 只有当新记录修改时间大于旧记录时才更新记录
     * @param contentJson   智能日志明细内容json字符串
     * @param modifier  修改者
     * @param modifytime    新记录修改时间
     * @return  成功更新的行数
     */
    int updateProjectLogDetailContentLatestById(@Param("pkProjectLogDetail") String pkProjectLogDetail, @Param("contentJson") String contentJson, @Param("modifier") String modifier, @Param("modifytime") Date modifytime);

}